RenderForm('checkbox');
/**
 * @return {string}
 */
function UserName_PassWord(username,password) {
    if(username.length==0||password.length==0){
        return "用户名密码不能留空";
    }
    if((username.length<6||password.length<6)||(username.length>20||password.length>20)){
        return "用户名密码必须再6~20个字符之间";
    }
    return null;
}

function LoginSeedVer(self) {
    button_disabled(self,"loading",1);
    var username=$("#username").val();
    var password=$("#password").val();
    var UserName_PassWord_text=UserName_PassWord(username.trim(),password.trim());
    if(UserName_PassWord_text!=null){
        $("#username").val("");
        $("#password").val("");
        Popup.msg(UserName_PassWord_text,{icon: 5});
        button_disabled(self,"发送",2);
        return;
    }
    if(RegChar(username)&&RegChar(password)){
        $("#username").val("");
        $("#password").val("");
        Popup.msg('用户名和密码不能包含特殊字符',{icon: 5});
        button_disabled(self,"发送",2);
        return;
    }
    $.post("/CenterInc/view_inc/Seed_email.aspx?mode=1",{username:username,password:password},function (data) {
        if(data['error']!=undefined){
            Popup.msg(data['error'],{icon: 5});
            button_disabled(self,"发送",2);
            return;
        }
        Popup.msg(data['msg'],{icon: 6});
        button_disabled(self,"发送",2);
    });
    console.log(username+" "+password);
}//登录界面的发送验证码

function Login(self) {
    button_disabled(self,"loading",1);
    var username=$("#username").val();
    var password=$("#password").val();
    var Emailver=$("#Email_ver").val();
    var setCookie=$("input[name='setCookiePwd']:checked").val();

    var UserName_PassWord_text=UserName_PassWord(username.trim(),password.trim());
    if(UserName_PassWord_text!=null){
        $("#username").val("");
        $("#password").val("");
        Popup.msg(UserName_PassWord_text,{icon: 5});
        button_disabled(self,"登录",2);
        return;
    }
    if(Emailver.length==0){
        Popup.msg("请输入验证码",{icon: 5});
        button_disabled(self,"loading",2);
        return;
    }
    $.post("/CenterInc/view_inc/login_register_inc.aspx?mode=1",
        {username:username,
         password:password,
         EmailVer:Emailver
        }
        ,function (data) {
            if(data["error"]!=undefined){
                Popup.msg(data["error"],{icon: 5});
                button_disabled(self,"loading",2);
                return;
            }
            Popup.msg(data["msg"],{icon: 6});
            window.parent.location.reload();
    });
}

function RegisterSeedVer(self) {
    button_disabled(self,"loading",1);
    var emailName=$('#email').val();
    if(emailName.length==0){
        Popup.msg("邮箱不能为空",{icon: 5});
        button_disabled(self,"发送",2);
        return;
    }
    if(ReqEmailChar(emailName)){
        $('#Email_ver').val("");
        Popup.msg("请输入正确的邮箱格式",{icon: 5});
        button_disabled(self,"发送",2);
        return;
    }
    $.post("/CenterInc/view_inc/Seed_email.aspx?mode=2",{emailName:emailName},function (data) {
        if(data["error"]!==undefined){
            Popup.msg(data["error"],{icon: 5});
            button_disabled(self,"发送",2);
            return;
        }
        Popup.msg(data["msg"],{icon: 6});
        return;
    });
}
function Register(self) {
    button_disabled(self,"loading",1);
    var username=$("#username").val();
    var password=$("#password").val();
    var emailname=$('#email').val();
    var Emailver=$("#Email_ver").val();
    var UserName_PassWord_text=UserName_PassWord(username.trim(),password.trim());
    if(UserName_PassWord_text!=null){
        $("#username").val("");
        $("#password").val("");
        Popup.msg(UserName_PassWord_text,{icon: 5});
        button_disabled(self,"登录",2);
        return;
    }
    if(emailname.length==0){
        Popup.msg("邮箱不能留空",{icon: 5});
        button_disabled(self,"登录",2);
        return;
    }
    if(Emailver.length==0){
        Popup.msg("请输入验证码",{icon: 5});
        button_disabled(self,"loading",2);
        return;
    }
    $.post("/CenterInc/view_inc/login_register_inc.aspx?mode=2",
        {username:username,
            password:password,
            EmailVer:Emailver,
            emailname:emailname
        }
        ,function (data) {
            if(data["error"]!=undefined){
                Popup.msg(data["error"],{icon: 5});
                button_disabled(self,"loading",2);
                return;
            }
            Popup.msg(data["msg"],{icon: 6});
            window.parent.location.reload();
        });
}

